<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="../js/mui.min.js"></script>
    <link href="../css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="../css/style.css" />
    <link rel="stylesheet" href="../css/swiper.css" />
    <link rel="stylesheet" href="../css/iconfont.css" />   
    <style>
    	.scroll {height:30px;width:60%;max-width:640px;overflow:hidden;color: #000000;display:inline-block;position: relative;position: absolute;left: 120px;top:6px;}
		.scroll ul {width:100%;position:absolute;left:0;top:0;}
		.scroll li {height:30px;line-height:30px;}
        .scroll li a{display: block;color: #666666;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 14px;}
        .swiper-wrapper img{height: 150px!important;}	
        .content{padding: 5px;}
        .content p{font-size: 14px;color: #666666;line-height: 25px;text-indent: 2em;}
        .content img{width: 100%;height: auto;display: block;}
        .news-ti{font-size: 16px;color: #222222;text-align: center;font-weight: normal;}
        .jiahao{font-size: 30px;position: absolute;top: 10px;right: 5px;color: #fff;}
    </style>
    <script type="text/javascript" src="../js/swiper.min.js" ></script>
    <script type="text/javascript" src="../js/jquery-1.8.0.min.js" ></script>
    <script type="text/javascript" src="../js/head_public.js" ></script>
    <script type="text/javascript" src="../js/common.js" ></script>
    <script type="text/javascript" src="../js/session.js" ></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=wqBXfIN3HkpM1AHKWujjCdsi"></script>
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
</head>
<body >
	<header class="mui-bar mui-bar-nav ding-bar" >
		<div style="position: relative;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title" >社区互助</h1>
		    <span class="jiahao" data-href="addhuzhu.html">＋</span>
		</div>
	</header>
	<div class="mui-content">
		<div class="top_huzhu">
			<div class="top_huzhu-active" flag="1">
				<span>
					未接互助
				</span>
			</div>
			<div flag="2">
				<span>
					已发互助
				</span>
			</div>
			<div flag="3">
				<span>
					已接互助
				</span>
			</div>
		</div>
		<!--下拉刷新容器-->
		    <div id="pullrefresh" class="newslist w620 mui-scroll-wrapper" style="position: static;">
				<!--数据列表-->
			    <div class="mui-scroll conferDiv" style="position: static;">
				    <ul class="huzhu-list" id="huzhu-list">
				    	<!--<li >
				    		<a data-href="">
				    			<div class="huzhu-t"><span class="only-line huzhu-tit">我需要一碗面我需要一碗面我需要一碗面我需要一碗面我需要一碗面我需要一碗面</span><span  class="huzhu-neirong" style="font-size: 14px;color: #666;">未完成</span></div>
				    			<p class="huzhutime"><span class="huzhu-name">服务补偿：</span><span class="huzhu-neirong" style="font-size: 16px;color: #ff7e00;">300</span></p>
				    			<p class="huzhutime"><span class="huzhu-name">开始时间：</span><span class="huzhu-neirong">012-12-12 20:20:20</span></p>
				    			<p class="huzhutime"><span class="huzhu-name">结束时间：</span><span class="huzhu-neirong">012-12-12 20:20:20</span></p>
				    		</a>
				    	</li>-->
				    	
				    </ul>
		        </div>
		    </div>
	</div>	
	<footer></footer>
	
		<script>
			
		var type = "1";
		
		var userid=getCookie("userid")
        var work=getCookie("work")
        var work_id=getCookie("workid") 
        if(!userid){
			alert("您还没有登录，请先登录");
			location.href="login.html"
		}
		var page=1;	
		var $height = $(window).height();
		var $height1 = $("header").height();
		$(".mui-scroll-wrapper").height( $height - $height1);
	    mui(".ding-bar").on("tap",".jiahao",function(){
	    	mui.openWindow({url:$(this).attr("data-href")})
//	    	location.href=$(this).attr("data-href")
	    })
	    mui("#huzhu-list").on("tap","a",function(){
	    	mui.openWindow({url:$(this).attr("data-href")})
//	    	location.href=$(this).attr("data-href")
	    })
	    mui.plusReady(function(){
            getContents();
            
		});	  
	    $(".top_huzhu div").click(function(){
	    	$("#huzhu-list").html("")
	    	page=1;
			type=$(this).attr("flag")
			$(this).addClass("top_huzhu-active").siblings("div").removeClass("top_huzhu-active");
			getContents();
		})
		mui.init({
			pullRefresh: {
				
				container: '#pullrefresh',
				down: {
					style:'circle',
					callback: pulldownRefresh
				},
				up: {
					contentrefresh: '正在加载...',
					callback: pullupRefresh
				}
			}
		});
			/**
		 * 下拉刷新具体业务实现
		 */
		function pulldownRefresh() {
			setTimeout(function() {
				mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
				location.reload();
			}, 1500);
		}
		/**
		 * 上拉加载具体业务实现
		 */
		function pullupRefresh() {
			setTimeout(function() {
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //参数为true代表没有更多数据了。
				getContents();
			}, 1500);
		}
		function getContents(){
		//热点新闻
		    var param={};
         	param.member_id=userid; 
		    param.page=page;
		    param.type=type;
			$.post(net+"/public/index.php?s=api/index/community/",param,function(data){
               if(data.code==200){
	               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
	               		var str="";
	               		
	               		$.each(data.result, function(i,value) {
	               			var price="";
		               		if(this.price!=null&&this.price!=""){
		               			price=this.price
		               		}else{
		               			price="无偿"
		               		}
		               	    var zhuangtai="";
		               	    if(this.is_get=="0"&&this.is_finish=="0"){
		               	    	zhuangtai="待互助"
		               	    }else if(this.is_get=="1"&&this.is_finish=="0"){
		               	    	zhuangtai="未完成"
		               	    }else if(this.is_get=="1"&&this.is_finish=="1"){
		               	    	zhuangtai="已完成"
		               	    }
	               		    str+='<li ><a data-href="huzhuinfo.html?id='+this.id+'"><div class="huzhu-t"><span class="only-line huzhu-tit">'+this.title+'</span><span  class="huzhu-neirong" style="font-size: 14px;color: #666;">'+zhuangtai+'</span></div>'
				    		    +'<p class="huzhutime"><span class="huzhu-name">服务补偿：</span><span class="huzhu-neirong" style="font-size: 16px;color: #ff7e00;">'+price+'</span></p>'
				    			+'<p class="huzhutime"><span class="huzhu-name">开始时间：</span><span class="huzhu-neirong">'+this.addtime+'</span></p>'
				    			+'<p class="huzhutime"><span class="huzhu-name">结束时间：</span><span class="huzhu-neirong">'+this.endtime+'</span></p></a></li>'	
				    	
	               		});
	               		page++;
	               	   $("#huzhu-list").append(str)
	               	}else{
	               		mui.toast("已经到底了")
	               	}
               }else{
//	               	mui.toast("暂无数据")
	            }
			   },'json'
			);
		}
		


		</script>
		
	</body>
</html>